using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;

namespace Microsoft.WowAddonStudio.FrameXml.Editor.ToolWindows
{
	/// <summary>
	/// Class that implements the tool window exposed by this package and hosts a user control.
	/// </summary>
	[ComVisible(true)]
	[Guid(GuidStrings.LayoutControlToolWindow)]
	public class LayoutControllerToolWindow : ToolWindowPane
	{
		private ILayoutControllerHost control;

		/// <summaryLayoutControlToolWindow
		/// Initializes a new instance of the <see cref="LayoutControllerToolWindow"/> class.
		/// </summary>
		public LayoutControllerToolWindow()
			: this(null)
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="LayoutControllerToolWindow"/> class.
		/// </summary>
		/// <param name="provider"></param>
		public LayoutControllerToolWindow(IServiceProvider provider)
			: base(provider)
		{
			Caption = Resources.LayoutControlToolWindowTitle;
		}

		/// <summary>
		/// Initialize WoWBenchToolWindow.
		/// </summary>
		protected override void Initialize()
		{
			base.Initialize();
			control = new HierarchicalLayoutControllerHost();
		}

		/// <summary>
		/// Gets the handle to the user control hosted in the Tool Window.
		/// </summary>
		/// <returns>An IWin32Window object.</returns>
		public override IWin32Window Window
		{
			get { return control; }
		}

		/// <summary>
		/// Gets or sets a value indicating whether this instance is visible.
		/// </summary>
		/// <value>
		/// 	<c>true</c> if this instance is visible; otherwise, <c>false</c>.
		/// </value>
		public bool IsVisible
		{
			get
			{
				var windowFrame = (IVsWindowFrame) Frame;
				return windowFrame.IsVisible() == VSConstants.S_OK;
			}
		}

		
	}
}